﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities;

namespace EventBus
{
    public class Student:AggregateRoot<Guid>
    {

        [DisplayName("姓名")]
        public string Name { get; set; }

        [DisplayName("年龄")]
        public int Age { get; set; }


        public void ChangeScoreCount(int score)
        {
            //ADD an EVENT TO BE PUBLISHED
            AddLocalEvent(
                new ScoreCountChangedEvent
                {
                    StudentId = this.Id,
                    Score = score
                }
            );
        }
    }

    public class ScoreCountChangedEvent
    {
        public Guid StudentId { get; set; }

        public int Score { get; set; }

    }
}
